<?php 

class Engine
{
    public $num = 4;
}

class Car
{
    public $data = [];
    protected $brand;
    public $power;

    public $engine;

    public function __call($name, $arguments)
    {
        echo "调用的成员方法不存在" . '<br/>';
    }

    public static function __callStatic($name, $arguments)
    {
        echo "调用的静态方法不存在" . '<br/>';
    }

    public function __set($name, $value)
    {
        $this->data[$name] = $value;
    }

    public function __get($name)
    {
        return $this->data[$name];
    }

    public function __invoke($brand)    
    {
        $this->brand = $brand;
        echo "蓝天白云，定会如期而至 --" . $this->brand . '<br/>';
    }

    public function __clone()
    {
        $this->engine = clone $this->engine;
    }
}

(new Car())->drive();
Car::drive();

$car = new Car();
$car->brand = '奔驰';
var_dump($car->brand);

$car->wheels = 4;
var_dump($car->wheels);
var_dump($car->data);

$car('宝马');

echo '<br/>__clone<br/>';

$benz = new Car();
$benz->brand = '奔驰';
$benz->power = '汽油';
$engine = new Engine();
$benz->engine = $engine;

$lnykco02 = clone $benz;
$lnykco02->brand = '领克02';
$lnykco02->power = '电池';
$lnykco02->engine->num = 3;

var_dump($benz);
var_dump($lnykco02);
